<?php
/*
 * #文件分享-评论模型
 * 	模型类--王昊天写
 */
class Comment extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
	function add($fid,$uid,$content){
		$this->load->helper('date');
    	$now = time();
    	$human_now_time = unix_to_human($now,TRUE,'eg');
    	$data = array(
    		'fid' => $fid,
    		'uid' => $uid,
    		'comment_content' => $content,
    		'comment_time' => $human_now_time,
    		'ip' => $_SERVER['REMOTE_ADDR']
    	);
    	$this->db->insert('dy_sharecomment',$data);
    }
	function get_all($fid){
    	$query = $this->db->query("SELECT * FROM dy_sharecomment WHERE fid = $fid ");
    	return $query->result_array();
    }
	function delete($cid){
    	$this->db->where('cid',$cid);
    	$this->db->delete('dy_sharecomment');
    }
}


/*
 * file name: comment.php
 */
